package com.ssy.lingxi.logistics.controller.feign;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.logistics.api.dto.request.CommonIdRequest;
import com.ssy.lingxi.logistics.api.dto.response.LogisticsOrderFeignResponse;
import com.ssy.lingxi.logistics.service.ILogisticsOrderFeignService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @menu 内部服务 - 物流单
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/10
 */
@RestController
@RequestMapping("/logistics/order/feign")
public class LogisticsOrderFeignController {

    @Resource
    private ILogisticsOrderFeignService logisticsOrderFeignService;

    /**
     * 物流单删除
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping(value = "/delete")
    public Wrapper<Void> deleteLogisticsOrder(@RequestBody @Validated CommonIdRequest request) {
        return logisticsOrderFeignService.deleteLogisticsOrder(request);
    }

    /**
     * 物流单信息
     * @param id 接口参数
     * @return 返回结果
     */
    @GetMapping(value = "/detail")
    public Wrapper<LogisticsOrderFeignResponse> getLogisticsOrder(@RequestParam(name = "id") Long id) {
        return logisticsOrderFeignService.getLogisticsOrder(id);
    }

    /**
     * 物流单列表
     * @param ids 接口参数
     * @return 返回结果
     */
    @PostMapping(value = "/list")
    public Wrapper<List<LogisticsOrderFeignResponse>> listLogisticsOrder(@RequestBody List<Long> ids) {
        return logisticsOrderFeignService.listLogisticsOrder(ids);
    }
}
